JooS.Browser = (function(ua) {
  var b = { name: "Mobile", version: 1 }, t;

  if (window.opera)
    b = { name: "Opera", version: window.opera.version() };
  else if (/*@cc_on!@*/false)
    b = { name: "IE", version: parseInt(ua.match(/MSIE\s(\d+\.\d+)/)[1]) };
  else if (t = ua.match(/AppleWebKit\/([\d.]+)/)) {
    t = parseFloat(t[1]);
    b = {
      name: "Safari", 
      varsion: (t<522.11 && 2) || (t<525.13 && 3) || (t<526.9 && 3.1) || 4
    };
  }
  else if (t = ua.match(/\sGecko\/(\d{6})/)) {
    t = parseFloat(t[1]);
    b = {
      name: "Firefox", 
      version: (t<200511 && 1) || (t<200610 && 1.5) || (t<200806 && 2) || 3
    };
  }
  b[b.name] = v;

  return b;
})(navigator.userAgent);
